/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package AirLine;

import java.io.Serializable;
import java.util.Comparator;

/**
 *
 * @author smulle
 */
public class Airport implements Comparable, Serializable{
    private String airportName = null;
    private String airportCode = null;
    public Airport(String name, String code){
        airportName = name;
        airportCode = code;
    }

    public String getAirportCode() {
        return airportCode;
    }

    public String getAirportName() {
        return airportName;
    }
    
    @Override
    public String toString(){
        return airportName;
    }
    
    public int compareTo(Object o){
        if(o instanceof Airport){
            return compareTo((Airport)o);
        }else{
            return -1;
        }
    }
    public int compareTo(Airport a){
       // System.out.println(a.getAirportName() + " " + a.getAirportCode() + "\n" + getAirportName() + " " + getAirportCode() );
        
        return airportName.compareToIgnoreCase(a.getAirportName());
    }    
    

}
